// @ts-ignore
/* eslint-disable */
import { OpenApi as request } from "@/utils/request";

/** 添加分类类目 POST /supplyChain/goods/category */
export async function add(
  body: API.SupplyChainGoodsCategoryDto,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseBoolean>(
    `/barter-goods/supplyChain/goods/category`,
    {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
      },
      data: body,
      ...(options || {}),
    }
  );
}

/** 分类类目详情 GET /supplyChain/goods/category/${param0} */
export async function detail1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.detail1Params,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseSupplyChainGoodsCategoryVo>(
    `/barter-goods/supplyChain/goods/category/${param0}`,
    {
      method: "GET",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 更新分类类目 PUT /supplyChain/goods/category/${param0} */
export async function edit(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.editParams,
  body: API.SupplyChainGoodsCategoryDto,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(
    `/barter-goods/supplyChain/goods/category/${param0}`,
    {
      method: "PUT",
      headers: {
        "Content-Type": "application/json",
      },
      params: { ...queryParams },
      data: body,
      ...(options || {}),
    }
  );
}

/** 删除分类类目 DELETE /supplyChain/goods/category/${param0} */
export async function del(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.delParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params;
  return request<API.BaseResponseBoolean>(
    `/barter-goods/supplyChain/goods/category/${param0}`,
    {
      method: "DELETE",
      params: { ...queryParams },
      ...(options || {}),
    }
  );
}

/** 获取分类(所有) GET /supplyChain/goods/category/all */
export async function all(options?: { [key: string]: any }) {
  return request<API.BaseResponseListSupplyChainGoodsCategoryVo>(
    `/barter-goods/supplyChain/goods/category/all`,
    {
      method: "GET",
      ...(options || {}),
    }
  );
}

/** 获取分类列表（树形） GET /supplyChain/goods/category/tree */
export async function listTree(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: API.listTreeParams,
  options?: { [key: string]: any }
) {
  return request<API.BaseResponseListSupplyChainGoodsCategoryVo>(
    `/barter-goods/supplyChain/goods/category/tree`,
    {
      method: "GET",
      params: {
        ...params,
      },
      ...(options || {}),
    }
  );
}
